# ~*~ coding: utf-8 ~*~
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import InputRequired

from apps.common.form import ErrorFormMinx

__all__ = ['EnvironmentForm']


class EnvironmentForm(ErrorFormMinx, FlaskForm):
    name = StringField(validators=[InputRequired('环境平台不能为空')])
    status = StringField()

    class Meta:
        csrf = True

    @property
    def data(self):
        return {
            'name': self.name.data,
            'status': int(self.status.data),
        }
